<template>
	<view class="shopping-cart" @click="goToShoppingCart">
		<view class="shopping-cart-block">
			<image src="/static/images/shopping-cart.png"  mode="" class="shopping-cart-image"></image>
		</view>
		<view class="shopping-cart-num">{{shoppingCartNum}}</view>
	</view>
</template>

<script>
	import { mapGetters,mapActions } from 'vuex'
	export default {
	  name: "ShoppingCartCom",
		computed: {
		...mapGetters([
			'shoppingCartNum',
		])
	},
	  props: {
	    product: {
	      type: Object,
	      required: true,
	      default: null
	    },
			scrollTop:{
				default:0
			},
			isFromHome:{
				default:false
			}
	  },
	  methods: {
	    goToProduct() {
				uni.setStorage({
				    key:"newsTop",
				    data:this.scrollTop
				})
	      uni.navigateTo({url: `/packs/pages/product/show?product_id=${this.product.id}&from=${this.isFromHome}`})
	    },
		goToShoppingCart() {
			
		  uni.navigateTo({url: `/packs/pages/cart/cart`})
		}
	  }
	}
</script>

<style>
	.shopping-cart{
		position:fixed;
		right:0rpx;
		bottom:200rpx;
		width:108rpx;
		height:108rpx;
	}
	.shopping-cart-block{
		width:104rpx;
		height:104rpx;
		line-height:104rpx;
		text-align:center;
		background:#fff;
		border-radius:104rpx;
		box-shadow:0 0 7rpx #999;
		
	}
	.shopping-cart-image{
		width:60rpx;
		height:58rpx;
		margin:22rpx auto;
	}
	.shopping-cart-num{
		position:absolute;
		top:0;
		right:0;
		width:40rpx;
		height:40rpx;
		border-radius:40rpx;
		background-color: #D84C29;
		color:#fff;
		text-align: center;
	}
</style>